<% if can? :manage, @group %>
  <%= render layout: "shared/modal", locals: {
    title: t("group_members.add_member.Add member"),
    button_text: t("group_members.add_member.Add member"),
    button_class: "btn btn-sm btn-primary"
  } do %>
    <div class="box-body overflow-auto">
      <%= form_with(model: Member.new, url: group_members_path(@group), method: :post) do |form| %>
        <div class="notice mb-3">
          <%= t("group_members.add_member.Enter username to find the member you want to add into the group") %>
        </div>

        <div class="form-group">
          <label class="control-label"><%= t("group_members.add_member.Search user") %></label>
          <%= render partial: "shared/autocomplete_users", locals: { input_name: "member[user_slug]" } %>
        </div>

        <div class="form-group mb-button">
          <%= form.label :role, class: "control-label" %>

          <div class="form-checkbox">
            <label>
              <input type="radio" name="member[role]" checked value="admin"> <%= t("group_members.add_member..Admin") %>
              <div class="form-text">
                <%= t("group_members.add_member.Admin has the highest authority in the group") %>
              </div>
            </label>
          </div>
          <div class="form-checkbox">
            <label>
              <input type="radio" name="member[role]" value="editor"> <%= t("group_members.add_member..Editor") %>
              <div class="form-text">
                <%= t("group_members.add_member..Can create, update docs or repositories of this group") %>
              </div>
            </label>
          </div>
          <div class="form-checkbox">
            <label>
              <input type="radio" name="member[role]" value="reader"> <%= t("group_members.add_member..Reader") %>
              <div class="form-text">
                <%= t("group_members.add_member.Readonly mode for all resources of this group") %>
              </div>
            </label>
          </div>
        </div>

        <div class="form-actions float-right">
          <button class="btn btn-primary"><%= t("group_members.add_member.Add member") %></button>
        </div>
      <% end %>
    </div>
  <% end %>
<% end %>
